#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <sys/timeb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h> // file option
#include <signal.h>
#include <dirent.h>
#include <pthread.h>
#include <lxPipe.h>

int main()
{
    struct pipeOptStruct tmpPip = pipeOptDefault();
    pipeOptInit(&tmpPip, "/tmp/tmpPip.txt", 100);
    logdebug("%s", tmpPip.pipFile);
    char tmpbuff[64 * 1024];
    char tmpListBuf[5][128];
    int tmpflag = 0;
    while (1)
    {
        tmpflag = pipeOptRead(&tmpPip, tmpbuff, sizeof(tmpbuff));
        if (tmpflag < 0)
        {
            logdebug("error");
            break;
        }
        else if (tmpflag == 0)
        {
            continue;
        }
        logdebug("%s", tmpbuff);
        tmpflag = sscanf(tmpbuff, "%128s %s %s %s %s", tmpListBuf[0], tmpListBuf[1], tmpListBuf[2], tmpListBuf[3], tmpListBuf[4]);
        logdebug("%d", tmpflag);
        for (int i = 0; i < tmpflag; i++)
        {
            logdebug("%s", tmpListBuf[i]);
        }
    }
    pipeOptFree(&tmpPip);
    return 0;
}